Telegram Group & Telegram Channel
Напишите линейную регрессию на Python с нуля

Это один из самых простых алгоритмов. Он включает следующие шаги:
1️⃣ Инициализация параметров.
2️⃣ Вычисление предсказаний.
3️⃣ Вычисление функции потерь.
4️⃣ Обновление параметров с помощью градиентного спуска.
5️⃣ Повторение до сходимости.
import numpy as np

class LinearRegression:
def __init__(self, learning_rate=0.01, n_iters=1000):
self.learning_rate = learning_rate
self.n_iters = n_iters

def fit(self, X, y):
n_samples, n_features = X.shape
self.weights = np.zeros(n_features)
self.bias = 0

for _ in range(self.n_iters):
model_preds = self.predict(X)
dw = (1 / n_samples) * np.dot(X.T, (model_preds - y))
db = (1 / n_samples) * np.sum(model_preds - y)

self.weights -= self.learning_rate * dw
self.bias -= self.learning_rate * db

def predict(self, X):
return np.dot(X, self.weights) + self.bias


#машинное_обучение
#программирование
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/ds_interview_lib/273
Create:
Last Update:

Напишите линейную регрессию на Python с нуля

Это один из самых простых алгоритмов. Он включает следующие шаги:
1️⃣ Инициализация параметров.
2️⃣ Вычисление предсказаний.
3️⃣ Вычисление функции потерь.
4️⃣ Обновление параметров с помощью градиентного спуска.
5️⃣ Повторение до сходимости.

import numpy as np

class LinearRegression:
def __init__(self, learning_rate=0.01, n_iters=1000):
self.learning_rate = learning_rate
self.n_iters = n_iters

def fit(self, X, y):
n_samples, n_features = X.shape
self.weights = np.zeros(n_features)
self.bias = 0

for _ in range(self.n_iters):
model_preds = self.predict(X)
dw = (1 / n_samples) * np.dot(X.T, (model_preds - y))
db = (1 / n_samples) * np.sum(model_preds - y)

self.weights -= self.learning_rate * dw
self.bias -= self.learning_rate * db

def predict(self, X):
return np.dot(X, self.weights) + self.bias


#машинное_обучение
#программирование

BY Библиотека собеса по Data Science | вопросы с собеседований


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/ds_interview_lib/273

View MORE
Open in Telegram


Библиотека собеса по Data Science | вопросы с собеседований Telegram | DID YOU KNOW?

Date: |

How Does Telegram Make Money?

Telegram is a free app and runs on donations. According to a blog on the telegram: We believe in fast and secure messaging that is also 100% free. Pavel Durov, who shares our vision, supplied Telegram with a generous donation, so we have quite enough money for the time being. If Telegram runs out, we will introduce non-essential paid options to support the infrastructure and finance developer salaries. But making profits will never be an end-goal for Telegram.

How to Buy Bitcoin?

Most people buy Bitcoin via exchanges, such as Coinbase. Exchanges allow you to buy, sell and hold cryptocurrency, and setting up an account is similar to opening a brokerage account—you’ll need to verify your identity and provide some kind of funding source, such as a bank account or debit card. Major exchanges include Coinbase, Kraken, and Gemini. You can also buy Bitcoin at a broker like Robinhood. Regardless of where you buy your Bitcoin, you’ll need a digital wallet in which to store it. This might be what’s called a hot wallet or a cold wallet. A hot wallet (also called an online wallet) is stored by an exchange or a provider in the cloud. Providers of online wallets include Exodus, Electrum and Mycelium. A cold wallet (or mobile wallet) is an offline device used to store Bitcoin and is not connected to the Internet. Some mobile wallet options include Trezor and Ledger.

Библиотека собеса по Data Science | вопросы с собеседований from in


Telegram Библиотека собеса по Data Science | вопросы с собеседований
FROM USA